// packageK/mycomponent/tabbar/index.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    active: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    iconWidth: '30px',
    iconHeight: '24px'
  },

  /**
   * 组件的方法列表
   */
  methods: {
    /**
     * tabbar切换
     * @param {Object} e 
     */
    tabbarChange: function(e) {
      const { detail } = e
      const { active } = this.data
      if (detail != active) {
        if (detail == 'home') {
          wx.redirectTo({
            url: '/packageK/index/index',
          })
        } else if (detail == 'category') {
          wx.redirectTo({
            url: '/packageK/category/category',
          })
        } else if (detail == 'cart') {
          wx.redirectTo({
            url: '/packageK/cart/cart',
          })
        } else if (detail == 'my') {
          wx.redirectTo({
            url: '/packageK/my/my',
          })
        }
      }
    }
  }
})